<include file="Public/min-header"/>
<div class="wrapper">
    <!-- Content Header (Page header) -->
    <include file="Public/breadcrumb"/>
    <section class="content">
        <!-- Main content -->
        <!--<div class="container-fluid">-->
        <div class="row">
            <div class="col-sm-12">
                <div class="panel panel-default">
                    <div class="pull-right">
                        <a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>
                    </div>
                    <div class="panel-heading">
                        <h3 class="panel-title"><i class="fa fa-list"></i>
                        <if condition="$qa_info[id] neq ''">修改问答<else/>添加问答</if>
                        </h3>
                    </div>
                    <div class="panel-body">
                        <form action="" method="post"   onsubmit="return checkForm(this);">
                            <input name="id" value="{$qa_info.id}" type="hidden" >
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
                                    <td class="col-sm-2">问题类型:</td>
                                    <td >

                                         <select class="di-bl fl seauii" name="type_id" id="type_id" >
                                             <option <if condition="$qa_info['type_id'] eq 1">selected</if>  value="1">卖店问答</option>
                                             <option <if condition="$qa_info['type_id'] eq 2">selected</if>  value="2">买店问答 </option>
                                             <option <if condition="$qa_info['type_id'] eq 3">selected</if>  value="3">操作问答 </option>
                                             <option <if condition="$qa_info['type_id'] eq 4">selected</if>  value="4">其他问答 </option>
                                         </select>


                                    </td>
                                    <td></td>
                                </tr>
                                <tr>
                                    <td class="col-sm-2">问题:</td>
                                    <td ><input type="text" class="form-control" name="question" id="question" value="{$qa_info.question}"></td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td class="col-sm-2">答案:</td>
                                    <td >
                                        <textarea rows="6" cols="120" name="answer" id="answer">{$qa_info.answer}</textarea>
                                    </td>
                                    <td></td>
                                </tr>

                                <tr>
                                    <td>状态</td>
                                    <td>
                                        关闭:<input type="radio" <if condition="$qa_info[status] eq 0">checked="checked"</if> value="0" name="status" />&nbsp;&nbsp;&nbsp;
                                        开启:<input type="radio" <if condition="$qa_info[status] eq 1">checked="checked"</if> value="1" name="status" />
                                    </td>
                                </tr>
                                <tr>
                                    <td></td>
                                    <td>
                                        <button type="submit" class="btn btn-info">
                                            <i class="ace-icon fa fa-check bigger-110"></i> 保存
                                        </button>
                                        <input type="reset" class="btn btn-default pull-right" value="重置">
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </form>

                    </div>
                </div>
            </div>
        </div>    <!-- /.content -->
    </section>
</div>
<script>


    function selectUser(){
        var goods_id = [];
        //过滤选择重复商品
        $('input[name*="goods_id"]').each(function(i,o){
            goods_id.push($(o).val());
        });
        var url = '/index.php?m=Admin&c=Coach&a=search_user';
//        var url = '/index.php?m=Admin&c=Activity&a=search_activity_goods&goods_id='+goods_id+'&t='+Math.random();
        layer.open({
            type: 2,
            title: '选择用户',
            shadeClose: true,
            shade: 0.3,
            area: ['70%', '80%'],
            content: url,
        });
    }





    function call_back(table_html)
    {
        layer.closeAll('iframe');
        $('#goods_list').append(table_html);
    }





    function checkForm(){
        var question = $('#question').val();
        var answer = $('#answer').val();
        var error ='';

        if(question == ''){
            error += "问题不能为空\n";
        }

        if(answer == ''){
            error += "答案不能为空\n";
        }

        if(error){
            layer.alert(error, {icon: 2});  //alert(error);
            return false;
        }
        return true;

    }
</script>

</body>
</html>